{
 "cells": [
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-08-28T01:37:56.254752Z",
     "start_time": "2025-08-28T01:37:56.062763Z"
    }
   },
   "cell_type": "code",
   "source": "import numpy as np",
   "id": "70efa9db3be3192d",
   "outputs": [],
   "execution_count": 4
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-08-28T01:53:53.406701Z",
     "start_time": "2025-08-28T01:53:53.402321Z"
    }
   },
   "cell_type": "code",
   "source": [
    "# 创建 0 维数组\n",
    "arr = np.array(5)\n",
    "print(\"arr:\",arr,sep=\"\\n\")\n",
    "print(\"arr的元素个数是：\",arr.size)\n",
    "print(\"数组的长度是：\",arr.shape)\n",
    "print(\"arr的维度:\",arr.ndim)\n",
    "print(\"元素的数据类型是：\",arr.dtype)"
   ],
   "id": "fb28772d9b0d2136",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "arr:\n",
      "5\n",
      "arr的元素个数是： 1\n",
      "数组的长度是： ()\n",
      "arr的维度: 0\n",
      "元素的数据类型是： int64\n"
     ]
    }
   ],
   "execution_count": 18
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-08-28T01:53:54.763003Z",
     "start_time": "2025-08-28T01:53:54.758644Z"
    }
   },
   "cell_type": "code",
   "source": [
    "# 创建 1 维数组\n",
    "arr = np.array([1,2,3.5])\n",
    "print(\"arr:\",arr,sep=\"\\n\")\n",
    "print(\"arr的元素个数是：\",arr.size)\n",
    "print(\"数组的长度是：\",arr.shape)\n",
    "print(\"arr的维度:\",arr.ndim)\n",
    "print(\"元素的数据类型是：\",arr.dtype)"
   ],
   "id": "145fdff3bc486fda",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "arr:\n",
      "[1.  2.  3.5]\n",
      "arr的元素个数是： 3\n",
      "数组的长度是： (3,)\n",
      "arr的维度: 1\n",
      "元素的数据类型是： float64\n"
     ]
    }
   ],
   "execution_count": 19
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-08-28T02:02:28.184618Z",
     "start_time": "2025-08-28T02:02:28.178058Z"
    }
   },
   "cell_type": "code",
   "source": [
    "# 创建 2 维数组\n",
    "arr = np.array([[1,2,3],[4,5,6]])\n",
    "print(\"arr:\",arr,sep=\"\\n\")\n",
    "print(\"arr的元素个数是：\",arr.size)\n",
    "print(\"数组的长度是：\",arr.shape)\n",
    "print(\"arr的维度:\",arr.ndim)\n",
    "print(\"元素的数据类型是：\",arr.dtype)\n",
    "print(\"arr的转置：\",arr.T,sep=\"\\n\")"
   ],
   "id": "d2d95dd10e59270c",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "arr:\n",
      "[[1 2 3]\n",
      " [4 5 6]]\n",
      "arr的元素个数是： 6\n",
      "数组的长度是： (2, 3)\n",
      "arr的维度: 2\n",
      "元素的数据类型是： int64\n",
      "arr的转置：\n",
      "[[1 4]\n",
      " [2 5]\n",
      " [3 6]]\n"
     ]
    }
   ],
   "execution_count": 21
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-08-28T09:09:42.246751Z",
     "start_time": "2025-08-28T09:09:42.242724Z"
    }
   },
   "cell_type": "code",
   "source": [
    "arr = np.array([[1,2,3],[4,5,6]],dtype=np.float64)\n",
    "print(\"arr:\",arr,sep=\"\\n\")"
   ],
   "id": "4e9256c4ad2c3252",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "arr:\n",
      "[[1. 2. 3.]\n",
      " [4. 5. 6.]]\n"
     ]
    }
   ],
   "execution_count": 27
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-08-28T09:09:45.949079Z",
     "start_time": "2025-08-28T09:09:45.944261Z"
    }
   },
   "cell_type": "code",
   "source": [
    "arr = np.array([[1,2,3],[4,5,6]],dtype=np.float64)\n",
    "arr1 = np.copy(arr)\n",
    "print(\"arr:\",arr,sep=\"\\n\")"
   ],
   "id": "729a51a629cfbad9",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "arr:\n",
      "[[1. 2. 3.]\n",
      " [4. 5. 6.]]\n"
     ]
    }
   ],
   "execution_count": 28
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
